import UIPoker from "../../view/Poker/UIPoker";
import { GameDB, Poker } from "../GameDB";



const { ccclass, property } = cc._decorator;

@ccclass
export  class GameView extends cc.Component {
    @property(cc.Prefab)pokerPrefab:cc.Prefab=null;
    @property(cc.Node)closeSendArea:cc.Node=null;
    @property(cc.Node)InitPokerArea:cc.Node=null;
    @property(cc.Node)oPenSendArea:cc.Node=null;
    @property([cc.Node])receiveAreaList:cc.Node[]=[];
    @property(cc.Node)playGroupAnchor:cc.Node=null;
    private  playGroupList:cc.Node[]=[];
   // public pokerContainer_:cc.Node=null;
 

    start () {
 
    }
    
    public InitPokers(pokers:Poker[])
    {
          //创建所有扑克牌
            pokers.forEach((poker_,index)=>{
            let uiPoker=this.CreateUPocker(poker_);
            uiPoker.node.x=0.5*index;
            this.InitPokerArea.addChild(uiPoker.node);

        })
    }

    private CreateUPocker(poker:Poker):UIPoker
    {
          let uiPokerNode=cc.instantiate(this.pokerPrefab);
          let uiPoker:UIPoker=uiPokerNode.getComponent(UIPoker);
          uiPoker.Init(poker);
          //uiPoker.node.setPosition(Math.random()*400+200,Math.random()*400+400);//或者是CC.randomRangeInt
          return uiPoker;
    }

}
